caixeta <- read.csv("caixeta.csv", as.is=T)

tabebuia <- subset(caixeta,caixeta$especie=="Tabebuia cassinoides")
str(tabebuia)
tabebuia$dap <- tabebuia$cap/pi
t1 <- aggregate(tabebuia$dap, list(tabebuia$arvore,tabebuia$local), FUN=sum)
t2 <- aggregate(tabebuia$h, list(tabebuia$arvore,tabebuia$local), FUN=max)
colnames(t1) <- c("arvore","local","dap")
colnames(t2) <- c("arvore","local","h")
head(t1)
head(t2)

######
## possvel outlier
## identify(t2$h,t1$dap)
## t1 <- t1[-148,]
## t2 <- t2[-148,]
######

plot(t2$h,t1$dap)

scatter.smooth(t2$h,t1$dap, xlab="Altura", ylab="DAP")

library(lattice)

t1$h <- t2$h
xyplot(dap~h|local,data=t1)